/**
 */
package wcomm_v1.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import wcomm_v1.Port;
import wcomm_v1.PortDefinition;
import wcomm_v1.Wcomm_v1Package;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Port</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link wcomm_v1.impl.PortImpl#getInstanceOf <em>Instance Of</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class PortImpl extends NamedElementImpl implements Port
{
  /**
   * The cached value of the '{@link #getInstanceOf() <em>Instance Of</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getInstanceOf()
   * @generated
   * @ordered
   */
  protected PortDefinition instanceOf;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected PortImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return Wcomm_v1Package.Literals.PORT;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public PortDefinition getInstanceOf()
  {
    if (instanceOf != null && instanceOf.eIsProxy())
    {
      InternalEObject oldInstanceOf = (InternalEObject)instanceOf;
      instanceOf = (PortDefinition)eResolveProxy(oldInstanceOf);
      if (instanceOf != oldInstanceOf)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, Wcomm_v1Package.PORT__INSTANCE_OF, oldInstanceOf, instanceOf));
      }
    }
    return instanceOf;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public PortDefinition basicGetInstanceOf()
  {
    return instanceOf;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setInstanceOf(PortDefinition newInstanceOf)
  {
    PortDefinition oldInstanceOf = instanceOf;
    instanceOf = newInstanceOf;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, Wcomm_v1Package.PORT__INSTANCE_OF, oldInstanceOf, instanceOf));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.PORT__INSTANCE_OF:
        if (resolve) return getInstanceOf();
        return basicGetInstanceOf();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.PORT__INSTANCE_OF:
        setInstanceOf((PortDefinition)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.PORT__INSTANCE_OF:
        setInstanceOf((PortDefinition)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case Wcomm_v1Package.PORT__INSTANCE_OF:
        return instanceOf != null;
    }
    return super.eIsSet(featureID);
  }

} //PortImpl
